import { request } from '@umijs/max';

//  获取样衣入库的信息
export async function GetInput(options) {
    // console.log('--',options)
    const {is_delete=''} = options
    const logo = !is_delete ? '':`&is_delete=${is_delete}`
    const { current,pageSize,id='', plate_name='',kind_max='',plate_date='',person='',localtion=''} = options
    return request(`/api/sample/InputTable/?page=${current}&size=${pageSize}&id=${id}&plate_name=${plate_name}&kind_max=${kind_max}&plate_date=${plate_date}&person=${person}&localtion=${localtion}`
        + logo,
        {
            method: 'get',
        });
}

// 添加入库数据
export async function PostInput(data){
    return request(`/api/sample/InputTable/`,{
        method:'post',
        data:data
    })
}
// 修改入库数据
export async function PatchInput(id,data){
    // const {  } = data
    return request(`/api/sample/InputTable/${id}/`,{
        method:'patch',
        data:data
    })
}
// 删除入库数据
export async function DeleteInput(id){
    return request(`/api/sample/InputTable/${id}/`,{
        method:'delete'
    })
}

//  获取样衣出库的信息
export async function GetOutput(options) {
    // console.log('--',options)
    const {is_delete=''} = options
    const logo = !is_delete ? '':`&is_delete=${is_delete}`
    const { current,pageSize,id='', inputtable_id='',out_date='',out_load='',out_type=''} = options
    return request(`/api/sample/OutputTable/?page=${current}&size=${pageSize}&id=${id}&inputtable_id=${inputtable_id}&out_date=${out_date}&out_load=${out_load}&out_type=${out_type}`+logo,
        {
            method: 'get',
        });
}

// 添加出库数据
export async function PostOutput(data){
    return request(`/api/sample/OutputTable/`,{
        method:'post',
        data:data
    })
}
// 修改出库数据
export async function PatchOutput(id,data){
    // const {  } = data
    return request(`/api/sample/OutputTable/${id}/`,{
        method:'patch',
        data:data
    })
}
// 删除出库数据
export async function DeleteOutput(id){
    return request(`/api/sample/OutputTable/${id}/`,{
        method:'delete'
    })
}

// 导入导出
export async function UploadExcel(from){
    return request(`/api/sample/upload/`,
    {
      method:"post",
      data:from
    })
  }
  
  // 下载
  export async function DownloadExcel(options){
    return request(`/api/sample/download/`,{
      method:"post",
      responseType: 'arraybuffer',
      data:options
    })
  }
 
  // 视图数据获取Inventory
  export async function Inventory(options){
    return request(`/api/sample/inventory/`,{
      method:"post",
      data:options
    })
  }